import java.util.Objects;

public class Test {
    public static void main(String[] args) {
       Student student1 = new Student();
       student1.name = "张三";
       Student student2 = new Student();
       student2.name = "张三";
        System.out.println(student1.equals(student2));


    }
}
class Student{
    String name;

    @Override
    public boolean equals(Object obj) {
        Student o = (Student) obj;
        return o.name.equals(this.name);
    }

    /*@Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Student)) return false;
        Student student = (Student) o;
        return Objects.equals(name, student.name);
    }*/

    @Override
    public int hashCode() {
        return 0;
    }
}
